﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Sinacor.Infra.UI.Controls.SmartClient
{
    public class TemplateHelper
    {
        const string templateNamePrefix = "ControlDataGrid";

        internal static void ApplyGridTemplate(object control)
        {
            string templateName = templateNamePrefix + control.GetType().Name;
            FrameworkElement element = (FrameworkElement)control;

            if (ControlHelper.FindParent(element, typeof(BaseCell)) != null)
            {
                element.SetResourceReference(FrameworkElement.StyleProperty, templateName);
            }        
        }
    }
}
